<!--
 * @Author: Terry
 * @Date: 2022-11-01 18:06:44
 * @LastEditors: Terry
 * @LastEditTime: 2024-10-30 18:06:53
 * @Description: file content
 * @FilePath: \auxface_web\src\components\dialogPopUp.vue
-->
<template>
  <transition name="el-zoom-in-center">
    <div class="AUX-preview-main">
      <div class="AUX-common-page-header">
        <el-page-header @back="goBack" :content="title" />
        <div class="options">
            <template v-if="ruleForm.uuid != undefined" v-has="editHas">
                <el-button type="primary" @click="handleConfirm('update', ruleForm)" >
                  修改</el-button>
            </template>
          <el-button v-else type="primary" @click="handleConfirm('create', ruleForm)">
            添加</el-button>
          <el-button @click="goBack">取消</el-button>
        </div>
      </div>
      <div class="preview-main" v-loading="formLoading" element-loading-text="加载中">
        <slot ref="mySlot"></slot>
      </div>
    </div>
  </transition>
</template>
<style lang="scss">

</style>
<script>
export default {
  props: {
    ruleForm: {
      type: Object,
      default: () => ({})
    },
    editHas: {
      type: String,
      default: () => ('')
    }
  },
  inject: ["title"],
  name: "dialogPopUp",
  data() {
    return {
      formLoading:false
    }
  },
  methods: {
    // 返回取消
    goBack() {
      this.$store.commit('changePopUp', true);
      this.$emit('close')
    },
    // 添加修改
    handleConfirm(type, ruleForm) {
      this.$emit('submit', type, ruleForm)
    }
  }
}
</script>
  